package com.nation.nationslidemenu;

import java.util.GregorianCalendar;

import android.annotation.SuppressLint;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.provider.CalendarContract;
import android.provider.CalendarContract.Events;
import android.util.Log;
import android.view.View;

public class AllIntent {
private Context context;
	
	public AllIntent(Context c )
	{
		context=c;
		
	}
	
	
    public  void ShareDG(String Link,String Text)
    {
    	
		Intent sendIntent = new Intent();
		sendIntent.setAction(Intent.ACTION_SEND);
		sendIntent.putExtra(Intent.EXTRA_TEXT,Text+Link);
		sendIntent.setType("text/plain");
		context.startActivity(sendIntent);
    }
	
    @SuppressLint("NewApi")
	public void calendar(String TITLE,String EVENT_LOCATION,String DESCRIPTION,
    					int Start_yy,int Start_mm,int Start_dd,
    					int End_yy,int End_mm,int End_dd)
    {
    	Intent intent = new Intent(Intent.ACTION_INSERT);
		intent.setType("vnd.android.cursor.item/event");
		intent.putExtra(Events.TITLE, TITLE);
		intent.putExtra(Events.EVENT_LOCATION, EVENT_LOCATION);
		intent.putExtra(Events.DESCRIPTION, DESCRIPTION);

		// Setting dates
		GregorianCalendar calDate_Start = new GregorianCalendar(Start_yy, Start_mm, Start_dd);
		GregorianCalendar calDate_End = new GregorianCalendar(End_yy, End_mm, End_dd);
		
		intent.putExtra(CalendarContract.EXTRA_EVENT_BEGIN_TIME,calDate_Start.getTimeInMillis());
		intent.putExtra(CalendarContract.EXTRA_EVENT_END_TIME,calDate_End.getTimeInMillis());

		// Make it a full day event
		intent.putExtra(CalendarContract.EXTRA_EVENT_ALL_DAY, true);

		// Make it a recurring Event
		intent.putExtra(Events.RRULE, "FREQ=WEEKLY;COUNT=11;WKST=SU;BYDAY=TU,TH");

		// Making it private and shown as busy
		intent.putExtra(Events.ACCESS_LEVEL, Events.ACCESS_PRIVATE);
		intent.putExtra(Events.AVAILABILITY, Events.AVAILABILITY_BUSY); 
		
		
		intent.setData(CalendarContract.Events.CONTENT_URI);
		context.startActivity(intent);
    	
    }
    
    public void CallPhone(String number)
    {
    	Intent i = new Intent(Intent.ACTION_DIAL);
        i.setData(Uri.parse("tel:"+number));
        context.startActivity(i);
   
    }
    
    public void SendEmail(String mail,String SUBJECT)
    {
    	
    	Intent emailIntent = new Intent(Intent.ACTION_SENDTO, Uri.fromParts("mailto",mail, null));
		emailIntent.putExtra(Intent.EXTRA_SUBJECT, SUBJECT);
		context.startActivity(Intent.createChooser(emailIntent, "Send email..."));
    }
    
    public void OpenWeb(String URL)
    {
    	
		Intent i = new Intent(Intent.ACTION_VIEW);
		i.setData(Uri.parse(URL));
		context.startActivity(i);
		Log.e("max","Createe");
    }
    
    
    public void OpenVDO(String VdoUrl)
    {
    ;
    	  Uri intentUri = Uri.parse(VdoUrl);
    	    
    	     Intent intent = new Intent();
    	     intent.setAction(Intent.ACTION_VIEW);
    	     intent.setDataAndType(intentUri, "video/*");
    	     context.startActivity(intent);
    	
    }
    
    
	
}
